<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0" />
    <title>basic multiplanar clone image</title>
    <style>
      section {
        margin: 20px;
      }
    </style>
  </head>
  <body style="font-family: sans-serif">
    <noscript>
      <strong
        >niivue doesn't work properly without JavaScript enabled. Please enable
        it to continue.</strong
      >
    </noscript>
    <section>
      <h1>Basic multiplanar cloned image</h1>
      <p>
        The most basic usage of NiiVue is to display a single image in the
        canvas.
      </p>
      <h3>Controls</h3>
      <ul>
        <li>
          move the crosshairs: left mouse click and drag (or click around)
        </li>
        <li>
          slice scrolling: mouse or touch pad scroll up and down (pinch zoom for
          mobile)
        </li>
        <li>
          change intensity range: right mouse click and drag a region (mobile
          not supported)
        </li>
        <li>
          reset intensity: left mouse click double click (mobile not supported)
        </li>
      </ul>
    </section>
    <!-- demo 1 -->
    <section>
      <div id="demo1" style="width: 90%; height: 400px">
        <canvas id="gl1" height="480" width="640"> </canvas>
      </div>
    </section>
    <!-- demo 2 -->
    <section>
      <div id="demo1" style="width: 90%; height: 400px">
        <canvas id="gl2" height="480" width="640"> </canvas>
      </div>
    </section>
    <script>
      import * as niivue from "../dist/index.js";
      
      const volumeList1 = [
        // first item is background image
        {
          url: "../images/mni152.nii.gz", //"./images/RAS.nii.gz", "./images/spm152.nii.gz",
          colormap: "gray",
          opacity: 1,
          visible: true,
        },
      ];
      async function load() {
        var nv1 = new niivue.Niivue();
        await nv1.attachTo("gl1");
        await nv1.loadVolumes(volumeList1);
        nv1.setSliceType(nv1.sliceTypeMultiplanar);
        var nv2 = new niivue.Niivue();
        await nv2.attachTo("gl2");
        nv2.setSliceType(nv2.sliceTypeMultiplanar);
        nv2.volumes.push(nv1.volumes[0].clone());
        nv2.updateGLVolume();
      }
      load();
    </script>
  </body>
</html>
